package com.wlsk.license.common.json.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.math.BigInteger;
import java.util.Objects;

/**
 * @description: Long转String
 * @author: liuzhangbin
 * @date: 2025/3/4
 */
public class BigIntegerToStringSerializer extends JsonSerializer<BigInteger> {

    @Override
    public void serialize(BigInteger value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        if (Objects.nonNull(value)) {
            jsonGenerator.writeString(value.toString());
        }
    }

}
